/*
 *  CalcuratorTester.cpp
 *  SoundController0002
 *
 *  Created by jiro on 11/04/02.
 *  Copyright 2011 jiro music. All rights reserved.
 *
 */

#include "CalcuratorTester.h"
#include "../Laboratory/Calclator.h"
#include "CustomAssert.h"

namespace sc {

	void CalcuratorTester::TestAll()
	{
				
		TestCalcDistance_000();

		TestCalcDistance_001();

		TestCalcDistance_002();
		
		TestCalcComplex_000();

		TestCalcComplex_001();

		TestCalcComplex_002();

	}

	void CalcuratorTester::TestCalcDistance_000()
	{
		AssertEqual( Calclator::CalcDistance( Note::A, Note::B ), 2 );
		AssertEqual( Calclator::CalcDistance( Note::B, Note::A ), 2 );
		AssertEqual( Calclator::CalcDistance( Note::A, Note::C ), 3 );
		AssertEqual( Calclator::CalcDistance( Note::B, Note::C ), 5 );
		AssertEqual( Calclator::CalcDistance( Note::C, Note::A ), 3 );
		AssertEqual( Calclator::CalcDistance( Note::C, Note::B ), 5 );
	}

	void CalcuratorTester::TestCalcDistance_001()
	{
		AssertEqual( Calclator::CalcDistance( Note::D, Note::C ), 2 );
		AssertEqual( Calclator::CalcDistance( Note::C, Note::D ), 2 );
	}

	void CalcuratorTester::TestCalcDistance_002()
	{
		AssertEqual( Calclator::CalcDistance( Note::C, Note::C ), 0 );
	}

	void CalcuratorTester::TestCalcComplex_000()
	{
		std::vector< Note::Id > chord( 2 );
		chord[ 0 ] = Note::A;
		chord[ 1 ] = Note::B;
		AssertEqual( Calclator::CalcComplex( chord ), 2 );
	}

	void CalcuratorTester::TestCalcComplex_001()
	{
		std::vector< Note::Id > chord( 3 );
		chord[ 0 ] = Note::A;
		chord[ 1 ] = Note::B;
		chord[ 2 ] = Note::C;
		AssertEqual( Calclator::CalcComplex( chord ), 2 + 3 + 5 );
	}

	void CalcuratorTester::TestCalcComplex_002()
	{
		std::vector< Note::Id > chord( 4 );
		chord[ 0 ] = Note::A;
		chord[ 1 ] = Note::B;
		chord[ 2 ] = Note::C;
		chord[ 3 ] = Note::EFlat;
		AssertEqual( Calclator::CalcComplex( chord ), 2 + 3 + 6 + 5 + 4 + 3 );
	}

}